package com.jj.protocol;

import com.alibaba.fastjson.JSON;
import com.jj.message.Result;
import com.jj.net.kcp.KcpState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.LinkedList;
import java.util.List;

/**
 * Copyrights: QidianGroup@JJ
 *
 * @author: LuHan
 * @date: 2018/1/16, 16:27
 */
public class RoomStatus {
    private static Logger logger = LoggerFactory.getLogger(RoomStatus.class);

    private String sceneId;
    private List<PlayerState> players;
    private KcpState kcpState;

    public String getSceneId() {
        return sceneId;
    }

    public void setSceneId(String sceneId) {
        this.sceneId = sceneId;
    }

    public List<PlayerState> getPlayers() {
        return players;
    }

    public void setPlayers(List<PlayerState> players) {
        this.players = players;
    }

    public KcpState getKcpState() {
        return kcpState;
    }

    public void setKcpState(KcpState kcpState) {
        this.kcpState = kcpState;
    }

    public static void main(String[] args) {
        Result<RoomStatus> result = new Result<>();

        KcpState kcpState = new KcpState();
        kcpState.host = "127.0.0.1";
        kcpState.port = 9002;
        kcpState.conv = 2;

        List<PlayerState> players = new LinkedList<>();
        PlayerState ps = new PlayerState();
        ps.setCharacterId(1);
        ps.setUid(1000000L);
        players.add(ps);
        PlayerState ps2 = new PlayerState();
        ps2.setCharacterId(2);
        ps2.setUid(1000001L);
        players.add(ps2);

        RoomStatus state = new RoomStatus();
        state.setKcpState(kcpState);
        state.setPlayers(players);
        state.setSceneId("S04");

        result.setValue(state);

        logger.debug("{}", JSON.toJSONString(result));
    }
}
